// 定义类型
declare module 'm3u8-parser' {
  export interface Segment {
    byterange: {
      length: number,
      offset: number
    },
    duration: number,
    attributes: any,
    discontinuity: number,
    uri: string,
    timeline: number,
    key: {
      method: string,
      uri: string,
      iv: string
    },
    map: {
      uri: string,
      byterange: {
        length: number,
        offset: number
      }
    },
    'cue-out': string,
    'cue-out-cont': string,
    'cue-in': string,
    custom: any
  }
  export interface Manifest {
    allowCache: boolean
    endList: boolean
    mediaSequence: number
    discontinuitySequence: number
    playlistType: string
    custom: any
    playlists: any[]
    mediaGroups: any
    dateTimeString: string
    dateTimeObject: Date
    targetDuration: number
    totalDuration: number
    discontinuityStarts: [number]
    segments: Segment[]
  }

  class Parser {
    push: (data: any) => void

    end: () => void

    manifest: Manifest
  }
}
